﻿using System;
using System.Collections.Generic;
using System.Text;

namespace GDModel.Model.Map
{
    /// <summary>
    /// 代表一张地图
    /// </summary>
    [Serializable]
    public class Map
    {
        private int m_id;
        /// <summary>
        /// ID
        /// </summary>
        public int Id
        {
            get { return m_id; }
            set { m_id = value; }
        }

        private string m_name;
        /// <summary>
        /// 地图名称
        /// </summary>
        public string Name
        {
            get { return m_name; }
            set { m_name = value; }
        }

        private Room[][] m_rooms;
        /// <summary>
        /// 地图内的房间数组
        /// </summary>
        public Room[][] Rooms
        {
            get { return m_rooms; }
            set { m_rooms = value; }
        }

        private string m_formula;
        /// <summary>
        /// 地图内房间点矩阵符号解析规则,为保持地图内的风格一致,所以把解析规则放在map类中,例如:
        /// 0:".stone",
        /// 1:".gate#D123C112",入口并指向D1号地图的x为2,y为3的房间,并引用第112号进入地图的条件
        /// 2:".npc#221,21",npc并指向221号npc,并引用21号npc的对话
        /// #为分隔符,前半部分为css类,后半部分为单元格隐藏的具体内容,由解析类解析
        /// 这里将充满玄机,为地图制作的重点。可参考jquery的css解析器。
        /// </summary>
        public string Formula
        {
            get { return m_formula; }
            set { m_formula = value; }
        }

        private string m_props;
        /// <summary>
        /// 属性串,保存地图的属性,例如：
        /// 隐身失效，时间加速等，数据结构待定
        /// </summary>
        public string Props
        {
            get { return m_props; }
            set { m_props = value; }
        }

        public Map() { }

        public Map(int id, string name) : this(id, name, null, null, null) 
        {

        }

        public Map(int id, string name, Room[][] rooms, string formula, string props)
        {
            this.m_id = id;
            this.m_name = name;
            this.m_rooms = rooms;
            this.m_formula = formula;
            this.m_props = props;
        }

    }
}
